﻿package view.component
{
    import com.greensock.*;
    import com.greensock.easing.*;
    import com.sh.game.global.*;
    import flash.utils.*;
    import morn.core.components.*;
    import morn.core.handlers.*;

    public class NBFly extends Object
    {

        public function NBFly()
        {
            return;
        }// end function

        public function show(param1:Object) : void
        {
            var _loc_2:* = param1.type + "_" + param1.id;
            App.mloader3.loadSWF(Config.getUrl("assets/images/nbfly/" + param1.type + "/" + _loc_2 + ".swf"), 1, new Handler(this.loadComp, [_loc_2]), null, null, false);
            return;
        }// end function

        private function loadComp(param1:String, param2) : void
        {
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_3:* = new Image("png.nbfly." + param1);
            GlobalLayer.instance.root.stage.addChild(_loc_3);
            _loc_4 = _loc_3.width;
            _loc_5 = _loc_3.height;
            _loc_3.scaleX = 0.7;
            _loc_3.scaleY = 0.7;
            _loc_3.x = GlobalLayer.instance.root.stage.stageWidth - _loc_4 * 0.7 >> 1;
            _loc_3.y = GlobalLayer.instance.root.stage.stageHeight - _loc_5 >> 1;
            var _loc_6:* = new TimelineLite();
            new TimelineLite().append(new TweenLite(_loc_3, 0.4, {scaleX:0.4, scaleY:0.4, x:GlobalLayer.instance.root.stage.stageWidth - _loc_4 * 0.4 >> 1, y:(GlobalLayer.instance.root.stage.stageHeight - _loc_5 >> 1) - 100, ease:Sine.easeIn}));
            _loc_6.append(new TweenLite(_loc_3, 0.3, {scaleX:0.7, scaleY:0.7, x:GlobalLayer.instance.root.stage.stageWidth - _loc_4 * 0.7 >> 1, y:(GlobalLayer.instance.root.stage.stageHeight - _loc_5 >> 1) - 250, ease:Sine.easeOut}));
            _loc_6.append(new TweenLite(_loc_3, 0.2, {scaleX:1, scaleY:1, x:GlobalLayer.instance.root.stage.stageWidth - _loc_4 >> 1, y:(GlobalLayer.instance.root.stage.stageHeight - _loc_5 >> 1) - 200, ease:Sine.easeIn, onComplete:this.moveComplete, onCompleteParams:[_loc_6, _loc_3, param1]}));
            return;
        }// end function

        public function moveComplete(param1:TimelineLite, param2:Image, param3:String) : void
        {
            param1.kill();
            param1 = null;
            var _loc_4:* = new Image("png.nbfly." + param3);
            GlobalLayer.instance.root.stage.addChild(_loc_4);
            _loc_4.x = param2.x;
            _loc_4.y = param2.y;
            TweenLite.to(_loc_4, 0.5, {scaleX:2, scaleY:2, alpha:0, x:_loc_4.x - (param2.width >> 1), y:_loc_4.y - (param2.height >> 1), onComplete:this.showComplete, onCompleteParams:[param2, _loc_4]});
            return;
        }// end function

        public function showComplete(param1:Image, param2:Image) : void
        {
            var _loc_3:int = 0;
            param2.parent.removeChild(param2);
            param2 = null;
            _loc_3 = setTimeout(this.doClear, 2000, _loc_3, param1);
            return;
        }// end function

        private function doClear(param1:int, param2:Image) : void
        {
            if (param1 > 0)
            {
                clearTimeout(param1);
                param1 = 0;
            }
            param2.parent.removeChild(param2);
            param2 = null;
            return;
        }// end function

    }
}
